package com.wangyk.user.service.impl;

import com.wangyk.rabbitmqcommon.VO.ResultVO;
import com.wangyk.user.service.RedisService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

@Service
@Slf4j
public class RedisServiceImpl implements RedisService
{
    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    @Override
    public ResultVO setRedisList()
    {
        //从redis中取值
        String s = stringRedisTemplate.opsForValue().get("yjzm:limitStr");
        log.info(s);
        //存入redis
        stringRedisTemplate.opsForValue().set("test:limitStr","这是测试数据",2, TimeUnit.MINUTES);
        return null;
    }
}
